FROM golang:1.17-alpine AS build
WORKDIR /httpserver/
COPY . .
ENV CGO_ENABLED=0
ENV GO111MODULE=on
ENV GOPROXY=https://goproxy.cn,direct
ENV GOOS=linux
ENV GOARCH=amd64
RUN go build -o httpserver main.go

FROM busybox
COPY --from=build /httpserver/httpserver /app
EXPOSE 8080
ENTRYPOINT ["./app"]